<template>
    <div class="con">
        <div class="header">
          <van-nav-bar title="视频购" left-text="返回"  right-text="分享" left-arrow class="spec" @click-right='share()' @click-left='tab1()'>
           <van-icon name="cluster-o" slot="right" />
            </van-nav-bar>
            <van-action-sheet v-model="show" title="分享到" height:30>
                <div class="share">
                    <share :config='config'></share>
                </div>
            </van-action-sheet>
      </div>
      <div class="main">
        <div class="v-good">
            <div class="v-good-wrap">
                <img src="../assets/p2.gif" alt="" style="width:400px;height:190px">
            </div>
            <div class="v-good-con">
              <p>{{pname1}}</p>
              <ul>
                  <li v-for="(item,i) in list1" :key="i" @click="detail(item.pid)">
                      <figure>
                          <img :src="item.pimg" alt="">
                          <figcaption>
                              <p>{{item.pname}}</p>
                              <span>￥{{item.pprice}}</span>
                          </figcaption>
                      </figure>
                  </li>
              </ul>  
            </div>
            
        </div>

        <div class="v-good">
            <div class="v-good-wrap" >
                <img src="../assets/p2.gif" alt="" style="width:400px;height:190px">

            </div>
            <div class="v-good-con">
              <p>{{pname2}}</p>
              <ul>
                 <li v-for="(item,i) in list2" :key="i" @click="detail(item.pid)">
                      <figure>
                          <img :src="item.pimg" alt="">
                          <figcaption>
                              <p>{{item.pname}}</p>
                              <span>￥{{item.pprice}}</span>
                          </figcaption>
                      </figure>
                  </li>
              </ul>  
            </div>
            
        </div>
        <div class="v-good">
            <div class="v-good-wrap" >
                <img src="../assets/p2.gif" alt="" style="width:400px;height:190px">
            </div>
            <div class="v-good-con">
              <p>{{pname3}}</p>
              <ul>
                   <li v-for="(item,i) in list3" :key="i" @click="detail(item.pid)">
                      <figure>
                          <img :src="item.pimg" alt="">
                          <figcaption>
                              <p>{{item.pname}}</p>
                              <span>￥{{item.pprice}}</span>
                          </figcaption>
                      </figure>
                  </li>
              </ul>  
            </div>
            
        </div>
      </div>
    </div>
</template>

<script>
import * as api from '../../api/getproductlist'
export default {
    name:'Videobuy',
     data(){
        return{
            show:false,
             pname1:'',
         pname2:'',
         pname3:'',
         vsrc1:'',
         vsrc2:'',
         vsrc3:'',
         list1:[],
         list2:[],
         list3:[],
            config:{
                url: 'http://www.baidu.com', // 网址，默认使用 window.location.href
		source:'', // 来源（QQ空间会用到）, 默认读取head标签：<meta name="site" content="http://overtrue" />
		title: 'hello', // 标题，默认读取 document.title 或者 <meta name="title" content="share.js" />
		description: 'hi', // 描述, 默认读取head标签<meta name="description" content="PHP弱类型的实现原理分析" />
		image : '', // 图片, 默认取网页中第一个img标签
		sites: ['qq', 'weibo','qzone' ,], // 启用的站点
		wechatQrcodeTitle: '微信扫一扫：分享', // 微信二维码提示文字
		wechatQrcodeHelper  : '<p>微信里点“发现”，扫一下</p><p>二维码便可将本文分享至朋友圈。</p>'

            }
        }
    },
    methods:{
        tab1(){
            this.$router.go(-1)
        }
        ,share(){
            this.show=true
        },
        detail(id){
        this.$router.push("/detailpro/" + id);
        }

    },
   beforeMount(){
      api.getvideo({}).then(data=>{
         this.videolist=data.data.data;
         this.pname1=this.videolist[0].pname;
         this.pname2=this.videolist[1].pname;
         this.pname3=this.videolist[4].pname;
         this.vsrc1=this.videolist[2].pvideo;
         this.vsrc2=this.videolist[2].pvideo
         this.vsrc3=this.videolist[3].pvideo
      })
   },
   mounted(){
       api.getclasspro({classid:1}).then(data=>{
           this.list1=data.data.data;
       })
       api.getclasspro({classid:2}).then(data=>{
           this.list2=data.data.data;
       })
       api.getclasspro({classid:3}).then(data=>{
           this.list3=data.data.data;
       })
   }
}
</script>

<style scoped>
h2,p,h3,h4,figure,ul{
    margin: 0
}
.social-share{
    display: flex;
    justify-content: space-between;
    padding: 0 38px
}
.share{
    height: 100px;
}
.v-good{
    margin-bottom: 10px;
    padding-bottom: 10px
}
.v-good-con{
    padding-left: 12px
}
.v-good-con ul {
    display: flex;
    flex-wrap: nowrap;
    overflow: auto
}
.v-good-con ul li{
    margin-right: 3px
}
.v-good-con ul li img{
    width: 100px;
    height: 100px;
    background: #f3f3f3;
    display: block
}
.v-good-con ul li p{
    width: 95px;
    word-break: break-all;
    text-overflow: ellipsis;
    display: -webkit-box;
    -webkit-box-orient: vertical;
    -webkit-line-clamp: 2;
    overflow: hidden;
    font-weight: normal;
    color: #323232;
    margin-top: 10px;
    line-height: 17px
}
.v-good-con ul li span{
    color: red;
    margin-top: 5px;
    font-weight: 600;
    font-size: 14px
}
.v-good-con>p{
    line-height: 15px;
    margin: 13px 0;
    font-size: 14px

}
.v-good-wrap{
    height:190px;
    width: 100%;
}
.van-nav-bar__text{
    color: #000
}
.van-nav-bar .van-icon{
    color: #333;
    margin-top: 3px
}
.van-nav-bar__title{
    font-size: 15px
}
.con{
    display: flex;
    flex-direction: column;
    background:#f3f3f3;
    height: 100vh;
}
.main{
    flex: 1;
    overflow: auto;
    background: #fff
}

</style>